---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: node-termination-handler
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "node-termination-handler")) | nindent 2 }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: d8:cloud-provider-aws:node-termination-handler
  {{- include "helm_lib_module_labels" (list . (dict "app" "node-termination-handler")) | nindent 2 }}
rules:
- apiGroups:
    - ""
  resources:
    - nodes
  verbs:
    - get
    - patch
    - update
- apiGroups:
    - ""
  resources:
    - pods
  verbs:
    - list
- apiGroups:
    - ""
  resources:
    - pods/eviction
  verbs:
    - create
- apiGroups:
    - extensions
  resources:
    - daemonsets
  verbs:
    - get
- apiGroups:
    - apps
  resources:
    - daemonsets
  verbs:
    - get
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: d8:cloud-provider-aws:node-termination-handler
  {{- include "helm_lib_module_labels" (list . (dict "app" "node-termination-handler")) | nindent 2 }}
subjects:
- kind: ServiceAccount
  name: node-termination-handler
  namespace: d8-{{ .Chart.Name }}
roleRef:
  kind: ClusterRole
  name: d8:cloud-provider-aws:node-termination-handler
  apiGroup: rbac.authorization.k8s.io
